class Todo(object):
#创建一个待办事项实体，初始化需要有的属性

    current_id=0
    @classmethod
    def next_id(cls):

        Todo.current_id+=1
        next_id = Todo.current_id

        return next_id#实现id自增操作

    def __init__(self,title='',id=0,completed=False):
        self.id=id if id>0 else Todo.next_id()
        self.title=title
        self.completed=completed
#构建对象的三种方式
# t1=Todo('zhangsan')
# #print(t1.__dict__)
# t2=Todo(id=3,title="占山",completed=False)
# #print(t2.__dict__)
# dict={'title':"学习",'id':4,'completed':True }
# t3=Todo(**dict)
# #print(t3.__dict__)


